

kmpkg_from_gitee(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO kumo-pub/llama
    REF v${VERSION}
    SHA512 6e268eb822e3746fcbf0ae6177bb2bc8f4c33272a8cfa81533c6c4434d0d27ac748ab022e32488521e3bee6f89475ab418e20db9483a02185f1c98fb3f952e86
    HEAD_REF master
)

kmpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
        FEATURES
        cuda GGML_CUDA
        musa GGML_MUSA
)

kmpkg_cmake_configure(
    SOURCE_PATH "${SOURCE_PATH}"
    OPTIONS
        ${FEATURE_OPTIONS}
        -DLLAMA_BUILD_TESTS=OFF
        -DLLAMA_BUILD_EXAMPLES=OFF
        -DLLAMA_BUILD_SERVER=OFF
)

kmpkg_cmake_install()
kmpkg_cmake_config_fixup(PACKAGE_NAME llama CONFIG_PATH lib/cmake/llama)
kmpkg_copy_pdbs()
kmpkg_fixup_pkgconfig()

kmpkg_copy_tools(
        TOOL_NAMES convert_hf_to_gguf.py
        AUTO_CLEAN
)

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
kmpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
